package com.java_senior_1;

import java.util.Iterator;
import java.util.LinkedList;

public class Test {
    public static void main(String[] args) {
        Book book1=new Book("java",100);
        Book book2=new Book("js",120);
        Book book3=new Book("js",130);
        LinkedList list=new LinkedList();
        list.add(book1);
        list.add(book2);
        list.add(book3);
        Book book4=new Book("java",100);
        Iterator iter=list.iterator();
      while (iter.hasNext()){
          Book book=(Book) iter.next();
         if (book.compareTo(book4)==0){
             System.out.println(book.getName());

         }
      }
    }
}
